package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 *酒店订单
 */
@Getter@Setter
@JsonIgnoreProperties("handler")
public class OrderForm extends BaseDomain{

    public final static int STATE_COMMON = 0;//拒绝
    public final static int STATE_HOT = 1;//待审核
    public final static int STATE_BARGAIN = 2;//审核通过
    public final static int STATE_DISABLE = -1;//没有入住

    //客户姓名
    private String name;
    //电话
    private String phone;
    //身份证号
    private String numberID;
    //入住时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd ",timezone = "GMT+8")
    private Date checkInTime;
    //离开时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd ",timezone = "GMT+8")
    private Date leaveTime;
    //金额
    private String money;
    //酒店
    private Grogshop grogshop;

    //补充说明
    private String commend;
    //状态
    private Integer state=STATE_HOT;

    public String getStateString(){
        String temp = "待审核";
        if(STATE_COMMON==state){
            temp = "拒绝";
        }else if(STATE_DISABLE==state){
            temp = "没有入住";
        }else if (STATE_BARGAIN==state){
            temp= "审核通过";
        }
        return temp;
    }


    /*public String getJson(){
        Map<String, Object> map = new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("phone",phone);
        map.put("numberID",numberID);
        map.put("checkInTime", DateUtil.formatDate(checkInTime));
        map.put("leaveTime",DateUtil.formatDate(leaveTime));
        map.put("money",money);
        map.put("grogshop",grogshop);
        map.put("state",state);
        if (grogshop!=null) {
            map.put("grogshopName",grogshop.getGrogshopName());
            map.put("grogshopId",grogshop.id);
        }
        return JSON.toJSONString(map);
    }*/

}